<template>
  <ul class="nav-tab-two-list">
    <li
      v-for="(tab, index) in tabList"
      :key="index"
      :class="{ active: curTab === index }"
      @click="handleChangeNavTab(index)"
    >
      {{ tab.pageSignName }}
    </li>
  </ul>
</template>

<script>
export default {
  name: 'twoTab',
  props: {
    curTab: {
      type: Number,
      default: 0
    },
    tabList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleChangeNavTab(index) {
      this.$emit('selectLifeTab', index);
    }
  }
};
</script>

<style lang="scss" scoped>
.nav-tab-two-list {
  background-color: #f9f9f9;
  width: 100%;
  height: 41px;
  overflow-x: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;

  li {
    flex: 1;
    height: 100%;
    font-size: 14px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: #f9f9f9;

    &:first-child {
      border-radius: 6px 0 0 0;
    }
    &:last-child {
      border-radius: 0 6px 0 0;
    }

    &.active {
      font-family: PingFangSC-Medium;
      font-weight: 500;
      color: #e62525;
      background-color: #fff;

      &:first-child {
        border-radius: 6px 0 0 0;
      }
      &:last-child {
        border-radius: 0 6px 0 0;
      }

      &:after {
        content: '';
        display: block;
        width: 14px;
        height: 2px;
        border-radius: 1px;
        background: #e62525;
        position: absolute;
        bottom: 4px;
        left: 50%;
        margin-left: -7px;
      }
    }
  }
}
</style>
